home *** CD-ROM | disk | FTP | other *** search
- Simple Computer Professional (SC Pro)
- Atari ST Version
- by Paul Hruby
- (c) 1990, 1991, 1992 Paul Hruby and
- Micro Designs Ltd.
- Version 2.41 3/24/91
-
- Based on: SC for Macintosh, by Sherman Uitzetter
- Applied Intelligence, Irvine, California.
-
-
- The Simple Computer Professional (known from now on as SC or SC
- Pro),is designed to teach beginning programmers about low level
- machine language. Its lets the programmer design, test and
- finally run very small programs without very much knowledge on
- how a computer actually operates. It also shows graphically each
- instruction as it is executed.
-
- Parts of the SC Machine
-
- The SC machine is divided up into a number of components:
-
- CPU: The CPU is now called the Micro Designs 69000 CPU.
-
- Memory: Most computers have two types of memory: Primary and
- Auxiliary memory. Primary memory is the computer's main memory.
- Auxiliary memory are devices such as hard drives, floppy disks
- and optical disks that store programs and data outside the
- computer's main memory. The SC uses only primary memory asits
- place to store computer programs and other data. The SC memory,
- unlike modern day computers, stores numbers in decimal digits
- rather than in binary digits. This makes its easy to look
- directly into memory and see the machine code.
-
- Each decimal number is stored in a address of its own. Only
- one instruction may be in each address cell. They may be accessed
- directly at any time (Random Access Memory). The SC's memory
- addresses are numbered from 0 to 99. Address 0 is considered ROM
- and may not be changed. Each address cell can only hold a 3 digit
- number at the most. This means the numerical range of values that
- may be placed in each memory address cell is between -999 to 999.
- The SC's memory is limited to only 100 cells with two digit
- numbers as addresses.
-
- Input (IC): This device holds data or program instructions
- in what is known as cards. The SC is able to read these cards and
- place them in memory. Think of a card as a address cell that can
- only into memory. The input device only reads each input card in
- sequential order. They can not be randomly accessed (a little
- like a tape drive). Input cards may only hold three decimal
- digits and a negative sign. The sign is not needed if the number
- is positive.
-
- Output (OC): Output cards work the same way as input cards
- but they can not be placed into memory. Memory places data into
- the output cards in sequential order.
-
- Accumulator (ACCUM): This is the first of the SC's three
- general purpose registers. The accumulator is used to preform
- math functions. When a number is placed in the accumulator it may
- be added to another number in memory, subtracted from a number
- number or even have its digits shifted left or right. The
- accumulator may also used to test for a negative value.
-
- Instruction Register (IR): This register is a communications
- link between memory and the control unit. It holds the current
- instruction that the control unit is to execute. The SC uses a
- three digit positive number as its instruction. This instruction
- is placed (fetched) in to the Instruction Register from memory.
- This is done so the control unit knows what the next instruction
- is to execute.
-
- Program Counter (PC): The third register on the SC. This
- register keeps track of the next program instruction to be
- executed. The value that the Program Counter displays is the
- address cell of that instruction. After each instruction is
- executed, the Program Counter is increamented by one. Hopfully,
- there is a instruction in that address cell. It is possible to
- change the current program counter to another part of memory.
- This is accumplished with the jump instruction.
-
- Control Unit: The Control Unit manages the process of
- executing program instructions. The first thing it does is to
- fetch or load the instruction that the Program Counter is
- pointing to. It then places the instruction in the Instruction
- Register. It then increments the Program Counter by one. Next it
- decodes the opcode portion of the instruction. The opcode
- instruction is the left most digit of the three decimal digit
- instruction. For example, the instruction 432 is the instruction
- the Control Unit wants to execute. The 4 is the opcode
- instruction and 32 is the operand (i.e. value that is to be used
- by the instruction). Finally, the control unit will execute the
- instruction.
-
- The SC Instrunction Set.
-
- The SC computer has a set of ten instructions. They are as
- follows:
-
- Machine Assembly
- Language Language Description
- Code Code
-
- 0 _ _ INP INPut - This instruction copies the
- contents of the current input card
- into memory address _ _ . It then
- advances to the next input card. If
- the input card is blank, then it will
- advance the input device, set the PC
- to zero and stop the processor.
-
- 1 _ _ OUT OUTput - This instruction copies the
- contents of memory address _ _ and
- stores it in the output card. The
- output device is then advanced to the
- next card.
-
- 2 _ _ ADD ADD - This instruction adds the
- contents of memory address _ _ to the
- current value in the accumulator. The
- result is then placed back in the
- accumulator.
-
- 3 _ _ SUB SUB - This instruction subtracts the
- contents of memory address _ _ from
- the current value in the accumulator.
- The result is then placed back in the
- accumulator.
-
- 4 _ _ LDA LoaD Accumulator - This instruction
- clears the contents of the
- accumulator and the copies the
- contents of memory address cell _ _
- into the accumulator.
-
- 5 _ _ STA STore Accumulator - The instruction
- copies the least significant three
- digits of the accumulator into
- address cell _ _ .
-
- 6 _ _ JMP JuMP - This instruction copies the
- present value of the PC into memory
- address 99. It then changes the PC to
- _ _ .
-
- 7 _ _ TAC Test ACcumulator - If the accumulator
- is a negative number then change the
- PC to _ _ .
-
- 8 x y SHF SHiFt - Shift the accumulator left x
- number of digits and then shift the
- accumulator right y number of digits.
- If all left shifts, zeros enter on
- the right. If all right shifts, zeros
- zeros enter on the left.
-
- 9 _ _ HLT HaLT - Set the PC to _ _ and then
- stop execution of the program.
-
-
- How to use SC Pro.
-
- SC Pro will run on any Atari ST, STe or TT with at
- least 512K of free memory and a color monitor. It will run with
- any version of TOS from 1.0 to 1.6. I have not been able to test
- it on a Mega STe or TT, but I don't see why it would not work.
-
- The computer must be set to medium resolution before running SC Pro.
- Once the SC Pro icon is displayed in the desktop window, move the
- mouse over to it and double click the icon.
-
- Once loaded, you will be presented with main computer
- screen. In it you will find the right half of the screen is taken
- up by the SC's main memory. Each cell is numbered from 0 to 99. A
- ____ means there is nothing in the cell. Programs and data are
- stored here.
-
- On the left side of the screen, on the top is the SC's
- registers. This holds the Accumulator (ACCUM: ), Instruction
- Register (IR: ), and finally the Program Counter (PC: ).
-
- The box directly below the registers is the Status box.
- Certain pieces of information will be displayed in this box. It
- will also ask you for information at times.
-
- Directly below the Status Box is the Input and Output cards
- box. The first eight input and output cards are displayed
- initaly. This box can be made to display other i/o cards by using
- the show input or show output from the menu bar. As a program
- enters values into the input or output cards, their appropriate
- window will scroll to display the current card.
-
- In the bottom right hand corner of the screen, the current
- number of free memory cells is displayed. This is your free RAM
- gadge.
-
- At the top there is a menu bar that holds all of the
- controls and tools of the SC machine. Each item on the menu bar
- has a keyboard equivalent printed next to it.
-
- Desk:
- About SC Pro - Keyboard equivalent: "A". This displays the
- name of the program, the version number, the programmer's name
- and a copyright notice.
-
- File:
-
- Load - Keyboard equivalent: "R". This option allows you to
- load a saved SC program from disk. The fileselector box will come
- up. Specify the drive, path and filename that the program is
- saved under. SC programs have a extention of .SC .
-
- Save - Keyboard equivalent: "W". This options saves the
- current SC program in memory to disk. It also saves the input and
- output cards. When the fileselector box comes up, specify the
- drive, path and filename to save the program under. SC programs
- have a extention of .SC .
-
- Print - Keyboard equivalent: "P". This option sends the
- contents of memory, input and output cards to a attached printer.
- Make sure the printer is on-line before continuing. It only
- prints address cells or cards that have something in them. It will
- also print the assembly code next to each memory instruction.
-
- Execute - Keyboard equivalent: "E". This option runs the
- program entered into memory. Before execution beings, SC will ask
- for the starting PC to begin execution at. If the current PC is ok,
- press return and SC will use it, otherwise enter the value and press
- return. If you do not want to run your program at this time, press the
- right mouse button or "(" key on the keyboard. Once the PC is entered,
- SC will continue execution until the program is halted or an error
- occures.
-
- Step - Keyboard equivalent: "T". This option alows you to
- trace through the program as it executes. After each instruction
- is executed the program will wait for either the space bar to be
- pressed or the left mouse button to be clicked.
-
- Clear CPU - Keyboard equivalent: "C". This options allows
- the user to erase memory and input & output cards with one
- function. The user is given a warning before all data is erased.
- Memory and the input & output cards may be erased one by one with
- clear memory, clear input or clear output.
-
- Clear Registers - Keyboard equivalent: "Z". This option allows the
- user to reset the PC or the Accumulator and Instruction Register
- back to zero.
-
- Set Speed - Keyboard equivalent: "S". This option allows the
- user to vary the speed of program execution. When this command is
- selected, a dialog box comes up. Press a box 1-4 to vary the
- speed. (1 is the slowest, 4 is the fastest). SC Pro is initially
- set to the fastest speed. Press Ok to leave the dialog box. The
- user may also use the keyboard to change the speed.
-
- Quit - Keyboard equivalent: "Q". This command leaves SC Pro
- and returns you to the desktop.
-
- Memory:
-
- Load Memory - Keyboard equivalent: "M". This function allows
- the user to enter a program and/or data into the SC's main
- memory. When this function is used, the screen will blank out and
- display the current contents of memory. It will then ask the user
- for the starting memory location to enter data at. After that the
- user may enter program instructions one by one, hitting return
- after each instruction. Memory cells may be deleted by pressing
- return at the prompt for data. Pressing ( or the right mouse
- button will exit the load memory routine and return the user
- to the main SC Pro screen.
-
- Clear Memory - Keyboard equivalent: "V". This command will
- erase the contents of the SC's main memory. The user is given a
- warning before the main memory bits the dust in order to back
- out.
-
- Input:
-
- Load Input - Keyboard equivalent: "X". This function allows
- the user to enter data or program instructions into input cards.
- When this function is used, the screen will blank out and will
- display the current contents of the input cards. It will then ask
- the user for the starting input card to enter data at. After that
- the user may enter data or even program instructions into the
- input cards one by one. Press return after each piece of data.
- Input cards may be deleted by pressing return at the prompt for
- data. Pressing ( or the right mouse button will exit the load
- input routine and return the user to the main SC Pro screen.
-
- Clear Input - Keyboard equivalent: "B". This function will
- erase the contents of the SC's input cards. The user is given a
- warning before the cards are trashed.
-
- Show Input - Keyboard equivalent: "I". This function allows
- the user to display a different portion of the input cards. It
- will ask the user for a value from 0 to 92. Entering a value will
- display that input card and the next seven input cards in the
- input card window. Entering 92 will display input cards from 92
- to 99. The last 8 input cards.
-
- Output:
-
- Clear Output - Keyboard equivalent: "N". This function will
- erase the contents of the SC's output cards. The user is, of
- course, given a warning before the cards are vaporized.
-
- Show Output - Keyboard equivalent: "O". This function allows
- the user to display a differenet portion of the output cards. It
- will ask the user for a vlaue from 0 to 92. Entering a value will
- display that output card and the next seven output cards in the
- output card window. Entering 92 will display output cards from 92
- to 99. The last 8 output cards.
-
- HELP!:
-
- The online help is divided into three sections, the SC command set,
- the menu bar and finally, the keypad. You may use the mouse or the
- + and - keys to page forward or back. Use the mouse or press return
- to quit.
-
- The Keypad:
-
- When SC Pro needs a value from you it will bring up a keypad on the
- screen. Use the left mouse button to press each key. The keyboard
- may also be used to input values into SC Pro. If you input a number
- that you don't want, press the CLR or * key to clear it and start over.
- If you would like to delete a value in a cell, press return by itself
- and the value will be cleared. To stop entering values into cells,
- press either the right mouse button or ( on the keyboard.
-
-
- Sample Programs:
-
- Here are a few sample programs to test out you new toy.
-
- Addition - This program will add two numbers together and put the
- result in the output cards. (The contents is the machine language
- instructions, mnemoniecs are the english equivalents)
-
- MEMORY:
- ADDRESS CONTENTS MNEMONIECS COMMENTS
- 20 040 INP 40 ;Address 40 get first #
- 21 041 INP 41 ;Address 41 get second #
- 22 440 LDA 40 ;Load accum with address 40
- 23 241 ADD 41 ;Add address 41 to accum.
- 24 542 STA 42 ;store accum in address 42
- 25 142 OUT 42 ;put address 42 in output cards
- 26 920 HLT 20 ;Stop the program & set PC to 20
-
- INPUT CARDS:
- CARD NO. CONTENTS
- 0 15 ;first number to be added
- 1 25 ;second number to be added
-
- Division - This program wil divide two numbers.
-
- MEMORY:
- ADDRESS CONTENTS MNEMONICES COMMENTS
- 20 804 SHF 0,4 ;zero out accum
- 21 534 STA 34 ;set quotient to zero
- 22 035 INP 35 ;read in dividend into M
- 23 036 INP 36 ;read in divisor into N
- 24 435 LDA 35 ;load in M into accum
- 25 336 SUB 36 ;subtract N from M
- 26 732 TAC 32 ;if accum<0 goto cell 32
- 27 535 STA 35 ;store reduced dividend
- 28 434 LDA 34 ;load previous quotent
- 29 200 ADD 00 ;add one to quotent
- 30 534 STA 34 ;store quotent back in Q
- 31 624 JMP 24 ;jump back to cell 24
- 32 134 OUT 34 ;output quotent
- 33 900 HLT 00 ;Halt & reset PC to zero
- 34 ;Q - The quotient
- 35 ;M - The dividend
- 36 ;N - The divisor
-
- INPUT CARDS:
- CARD NO. CONTENTS COMMENTS
- 0 10 ;dividend M
- 1 5 ;divisor N
-
-
- Also included in this lzh file are a number of programs to test the
- SC with. Just set the PC to the starting instruction and being. I
- believe they all have a starting PC of 20. Finally, I am including
- two NeoDesk 3 icons for SC Pro and it's program files.
-
- Update Histroy
-
- SC Pro 1.0 - Was a menu driven text based version of SC Pro. It had
- options to load memory and input cards. It could display memory, i/o
- and registers at any time. Finally, it could execute any program.
-
- SC Pro 2.0 - Gem based version. This was an exact dublicate of SC for
- the Macintosh. This version was written as a final class project in a
- machine language class I took. Got an "A"!
-
- SC Pro 2.2 - This version added a dialog box to place data into
- memory and input cards. Before, it was just a text based input
- system.
-
- SC Pro 2.4 - In past versions, SC Pro had to completely redraw the
- screen when ever something changed. 2.4 now only changes whatever
- needs to be updated. This version also added a better load and save
- routine that would give error messages. Finally, this version saves
- the current desktop colors and restores them when quiting. It also
- checks for enough free memory to run and checks for medium res.
-
- SC Pro 2.41 - This version takes care of a few small bugs in the
- shifting command and other places. Load and save now remember the
- current disk path and displays a hour glass during disk access.
-
- Known bugs:
-
- Every so often, SC Pro will display bold characters when things are
- written to the screen. Once this bold characters are updated, the
- display get messed up. I blame GFA Basic 2.0 for having such a losely
- way of mixing text with graphics for this. If this happens, save what
- you are doing, exit to the desktop and re-run SC Pro. This should take
- care of it. SC Pro is currently being rewritten in a combination of C
- and Pascal to fix this problem and add a little speed. As always
- please report any bugs to the address below or leave E-mail on GEnie.
-
- Future Plans:
-
- 1. Version 2.6 will hopefully be out RSN. <HA! HA!> It will
- allow SC Pro to be expanded just like a "real" computer. You can add
- things like the following:
-
- -- Extended memory - You can add 99 cell memory pages to the SC
- and be able to bank switch amoung them.
- -- Graphics card - You will be able to do simple turtle graphics
- in four colors.
- -- Sound card - At least three sound channels. Maybe even through
- the STe's audio ports.
- -- Math Co-processor - Will allow SC Pro to multiply, divide and
- other math functions without writting it yourself.
- -- MD69010 CPU - This new CPU will have a number of general
- registers, stack, pointer and other options.
-
- 2. I am working on improving the graphical interface to include more
- windows, dialog boxes and sliders.
-
- 3. Version 2.6 will also run in high res!
-
-
- These enhancements can and will only happen if you make yourself a
- registered user. So far, I have 76 registered users and three schools
- across the country. Lets try and make it an even 100! See below for
- more details.
-
-
- Copyright Information
-
-
-
- SC Pro (SCPRO241.PRG), all SC programs included in this LZH file,
- (ABS.SC, ADD.SC, BOOTSTRP.SC, DIVIDE.SC, LDEXECT.SC, MAX_NUM.SC,
- MULTIPLY.SC and SHIFTING.SC), SC Pro NeoDesk 3 icons (SC.NIC), and the
- documentation (SCDOC.TXT) are:
-
- Copyright = 1990, 1991, 1992 Paul Hruby and Micro Designs Ltd.
-
- All rights reserved.
-
- SC Pro is distributed as SHAREWARE. This means that you are free
- (under the conditions explained below) to give copies of the program
- to friends, upload it to bulletin boards, etc. If you end up using the
- program, you are expected to become a registered user by sending a
- shareware payment of at least $15.00 to:
-
- Paul Hruby
- 100 Aberdeen Drive, Box #237
- Riverside, Ca. 92507
-
- Shareware can a feasible alternative to the normal means of
- distribution; but it will only work if you do send in your
- registration fee. So if you'd like to see further updates to SC Pro
- and other useful shareware programs, your support will make a
- difference!
-
-
- If you have suggestions for improving SC Pro, your opinions will carry
- more weight if you're registered; You can reach me at the above
- address.
-
- If you would like an acknowledgement that I've received your
- registration fee, please include a self-addressed stamped envelope
- along with your payment.
-
- SC Pro may be freely distributed as long as all of the above-mentioned
- files are included, and as long as none of the files are altered in
- any way whatsoever. The program may not be sold or included with a
- commerical product without the express written consent of the author.
- Also, this documentation may not be reprinted without the express
- written consent of the author.
-
- SC Pro 2.41
- Paul Hruby
- 100 Aberdeen Drive, Box £ 237
- Riverside, Ca. 92507
- GEnie E-mail: P.HRUBY
-
- ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
- SC Pro
-
-